﻿@model Vcare.Models.Members

<div class="spacer"></div>
@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Add Member</legend>
        @Html.HiddenFor(m => m.MembershipID)

        <div class="editor-label">
            @Html.LabelFor(model => model.ContactDate)
        </div>
        <div class="editor-field">
        <input type="text" name="ContactDate" id="ContactDate" />
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Phone)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Phone, new { @class="phone"})
            @Html.ValidationMessageFor(model => model.Phone)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Title)
        </div>
        <div class="editor-field">
            @Html.DropDownList("Title")
            @Html.ValidationMessageFor(model => model.Title)    
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Firstname)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Firstname)
            @Html.ValidationMessageFor(model => model.Firstname)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Lastname)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Lastname)
            @Html.ValidationMessageFor(model => model.Lastname)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.housenumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.housenumber)
            @Html.ValidationMessageFor(model => model.housenumber)
        </div>


        <div class="editor-label">
            @Html.LabelFor(model => model.Address)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Town)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Town)
            @Html.ValidationMessageFor(model => model.Town)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.County)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.County)
            @Html.ValidationMessageFor(model => model.County)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Postcode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Postcode)
            @Html.ValidationMessageFor(model => model.Postcode)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.PaymentType)
        </div>
        <div class="editor-field">
            @Html.DropDownList("PaymentType")
            @Html.ValidationMessageFor(model => model.PaymentType)
        </div>

        <div id="directdebit">
        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.AccountNo)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AccountNo)
            @Html.ValidationMessageFor(model => model.AccountNo)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Sortcode)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Sortcode)
            @Html.ValidationMessageFor(model => model.Sortcode)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.AccountName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.AccountName)
            @Html.ValidationMessageFor(model => model.AccountName)
        </div>
        </div>

        <div id="creditcard">
        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CardType)
        </div>
        <div class="editor-field">
            @Html.DropDownList("CardType");
            @Html.ValidationMessageFor(model => model.CardType)
        </div>
        <div class="spacer"></div>
        <div class="editor-label maestro">
            @Html.LabelFor(model => model.StartDate)
        </div>
        <div class="editor-field maestro">
            @Html.EditorFor(model => model.StartDate)
            @Html.ValidationMessageFor(model => model.StartDate)
        </div>

        <div class="editor-label maestro">
            @Html.LabelFor(model => model.IssueNumber)
        </div>
        <div class="editor-field maestro">
            @Html.EditorFor(model => model.IssueNumber)
            @Html.ValidationMessageFor(model => model.IssueNumber)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CardHoldersName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CardHoldersName)
            @Html.ValidationMessageFor(model => model.CardHoldersName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.CardNumber)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.CardNumber)
            @Html.ValidationMessageFor(model => model.CardNumber)
        </div>

        @Html.HiddenFor(model => model.CVCNumber)

        <div class="editor-label">
            @Html.LabelFor(model => model.ExpiryDate)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ExpiryDate)
            @Html.ValidationMessageFor(model => model.ExpiryDate)
        </div>
        </div>

        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.PricePlan)
        </div>
        <div class="editor-field">
            @Html.DropDownList("PricePlan", Model.PricePlan);
            @Html.ValidationMessageFor(model => model.PricePlan)
        </div>
 
        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.Multiroom)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Multiroom)
            @Html.ValidationMessageFor(model => model.Multiroom)
        </div>

        <div class="spacer"></div>
        <div class="editor-label">
            @Html.LabelFor(model => model.CommentsOnBoxType)
        </div>
        <div class="editor-field">
            @Html.TextAreaFor(model => model.CommentsOnBoxType)
            @Html.ValidationMessageFor(model => model.CommentsOnBoxType)
        </div>
        <div class="spacer"></div>
        <p>
            <input type="submit" value="Create"  style="width:100px;"/>
        </p>
    </fieldset>
}
<div class="spacer"></div>
<div>
    @Html.ActionLink("Back to List", "Index")
</div>



<script type="text/javascript">
    $(document).ready(function () {

        $('#Phone').on('focus blur', function() {
        if($(this).val()!="")
        {
            $.ajax({
                type: "GET",
                url: "@(Url.Action("CheckTPSNumber", "Members"))/?telephoneNumber=" + $('#Phone').val(),
                success: function(data){
                if(data=="Fail")
                    {
                        $('#Phone').val('Failed TPS/Duplication Check');
                    }
                }
            });
        }
        });

        $("#ContactDate").datepicker({
        changeMonth: true,
        changeYear: true,
        regional: 'en-GB',
        dateFormat: 'dd/mm/yy'
        });

        $('#ContactDate').val('@(DateTime.Now.ToShortDateString())');

        $("#directdebit").toggle();

        $('#PaymentType').change(function () {
            $("#creditcard").toggle();
            $("#directdebit").toggle();
        });

    });
</script>

